﻿/**
 * @class Ajax
 * 依赖于jQuery的Crossdomain Ajax
 */
core.Ajax = core.ajax = function(options){
  core.Object.extend(options, {});
  if(options.url.indexOf("http") !== 0){
    options.url = location.protocol +
      "//" + location.hostname +
      (location.port ? (":" + location.port) : "") +
      (options.url.indexOf("/") === -1 ? ("/" + options.url) : options.url);
  }
  var host = options.url.replace(/(https?:\/\/)?([^\/]+)(\s|\S)*/g, "$2");
  core.Domain.use(host, function(){
    $.ajax(options);
  });
  return this;
};
